#!/usr/bin/env python
import unittest
import pygame

# Constants for MonospaceTestFont.
# Size of each character, not including spacing.
CHAR_X = 4
CHAR_Y = 9

# Size of spacing between characters and lines.
SPACE_X = 1
SPACE_Y = 1

# Effective size of each character.
TOTAL_X = CHAR_X + SPACE_X
TOTAL_Y = CHAR_Y + SPACE_Y

# Used to set a colorkey when no background color is specified.
COLORKEY = pygame.color.THECOLORS["magenta"]

class MonospaceTestFont(object):
    """A dummy monospace font for testing.  Mimics pygame.font.Font."""

    def __init__(self, filename="", size=0):
        pass

    def metrics(self, text):
        """Test stand-in for Font.metrics. (monospace)"""
        return [(0, CHAR_X, 0, CHAR_Y, TOTAL_X)] * len(text)

    def size(self, text):
        """Test stand-in for Font.size. (monospace)"""
        if len(text) == 0:
            return (0, 0)
        return ((TOTAL_X) * len(text), CHAR_Y)

    def get_linesize(self):
        """Test stand-in for Font.get_linesize. (monospace)"""
        return TOTAL_Y

    def render(self, text, antialias, color, background=None):
        """Test stand-in for Font.render. (monospace)

           Characters are rendered as CHAR_X x CHAR_Y solid squares of the
           specified color.  Antialias is ignored.
        """
        render_surface = pygame.Surface(self.size(text))
        if background != None:
            render_surface.fill(background)
        else:
            render_surface.fill(COLORKEY)
            render_surface.set_colorkey(COLORKEY)

        for index, character in enumerate(text):
            render_surface.fill(color, (TOTAL_X * index, 0, CHAR_X, CHAR_Y))

        return render_surface

class TextTest(unittest.TestCase):
    def test_bla( self ):
        """ bla
        """
        self.assertEquals("bla" ,"bla")
        #self.assertRaises( ValueError, afunc,  "bla arg" )


if __name__ == '__main__':
    unittest.main()




